import { SearchParamsEntity } from '@/pages/historyMeeting/interface'
import requestMeeting, { request } from '@/plugins/axios'
import { HistoryMeetingEntity } from './interface'
import dayjs from '@/plugins/dayjs'

/**请求历史会议列表*/
export const fetchGetHistoryMeetingList = async (params: SearchParamsEntity) =>
	request<{
		meetings: Array<HistoryMeetingEntity>
		total: number
	}>({
		url: `/meetings/web`,
		method: 'GET',
		params: {
			...params,
			start_time: dayjs(params.start_time).tz().format(),
			end_time: dayjs(params.end_time).tz().format(),
		},
	}).then((res) => res)

/** 删除历史会议 */
export const fetchDeleteHistoryMeeting = async (ids: string) =>
	requestMeeting({
		url: '/history_meetings',
		method: 'DELETE',
		data: ids,
		headers: {
			'Content-Type': 'text/plain',
		},
	}).then((res) => res.success)
